<template>
  <div>
    <table-where :forms="forms"></table-where>
    <wms-table ref="tableQuery" :tableDatas="tableDatas"></wms-table>
  </div>
</template>

<script setup name="库存列表">
import { ref, reactive } from 'vue'
import { POSTJSON } from '@/components/utils/http'
import { MessageBox } from '@/components/utils/api'
import { useWmsGlobal } from '@/store/wmsGlobal'
const wmsGlobal = useWmsGlobal()
const tableDatas = reactive({
  body: {
    //表数据
    head: 'storehousePage',
    url: '/Storehouse/getStorehousePage',
    params: {},
    type: 'POSTJSON'
  }
})

const tableQuery = ref()

const onSubmit = () => {
  tableQuery.value.getData()
}

const forms = reactive({
  data: tableDatas.body.params,
  compValue: [
    {
      placeholder: '供应商',
      value: 'params',
      id: 'c_id',
      type: 'iconinput',
      onclick: () => {
        wmsGlobal.getClient(forms.data.params).then(data => {
          forms.data.c_id = data.id
          forms.data.params = data.name
        })
      }
    },
    {
      placeholder: '商品信息',
      value: 'paramsG',
      id: 'g_id',
      type: 'iconinput',
      onclick: () => {
        wmsGlobal.getGoods(forms.data.paramsG).then(data => {
          forms.data.g_id = data.id
          forms.data.paramsG = data.name
        })
      }
    },
    { label: '查询', type: 'button', onclick: onSubmit }
  ]
})

</script>
